package com_djm_2025_05_11;

/**
 * @author dengjiangming
 *
 */
public class Demo1 {
    //判断一个数是否是素数
    public static boolean judge(int num){
        if(num == 1 || num == 2){
            return true;
        }

        boolean result  = true;
        for(int i = 2;i<=Math.sqrt(num);i++){
            if(num % i == 0){
                result = false;
            }
        }

        return result;
    }
    //打印1-100之间的素数
    public static void main(String[] args) {
        for (int i = 1; i <= 100; i++) {
            if (judge(i)) {
                System.out.println(i);
            }
        }
    }

}

